import sys
from app_masterworkers import *
test_tasks = []
test_actions = []


def load():
    fp = open('./test_data/DQN/actions')
    line = fp.readline()
    while line:
        test_actions.append(eval(line))
        line = fp.readline()
    fp.close()

    fp = open('./test_data/DQN/tasks')
    line = fp.readline()
    while line:
        test_tasks.append(eval(line))
        line = fp.readline()
    fp.close()



if __name__ == '__main__':
    load()
    argv = ['trace_analyze.py', '../platform/platform.xml', 'master-workers_d.xml', '--cfg=tracing:yes', '--cfg=tracing/actor:yes']
    e = Engine(argv)
    e.load_platform(argv[1]) 
    tasks = test_tasks[0]
    actions = test_actions[0]
    Actor.create('Tremblay', Host.by_name('Tremblay'), master, tasks, actions)
    e.run()